package com.moleq.models;

import com.moleq.db.DatabaseSchema;

import android.R.integer;
import android.R.string;

public class PrinterSetting {
//	CREATE TABLE t_printer_setting
//	(ps_id INTEGER NOT NULL,
//	ps_name varchar(50) NOT NULL,
//	ps_ip varchar(32) NOT NULL,
//	ps_port integer NOT NULL;
//	PRIMARY KEY (ps_id));
	
	private int ps_id;
	private String ps_name;
	private String ps_ip;
	private int ps_port;
	private String type;
	private boolean isEdit = false;
	private int no;
	public int getNo() {
		return no;
	}
	public void setNo(int no) {
		this.no = no;
	}
	public PrinterSetting(){}
	public PrinterSetting(int ps_id,String ps_name,String ps_ip,int ps_port){
		this.ps_id = ps_id;
		this.ps_name = ps_name;
		this.ps_ip = ps_ip;
		this.ps_port = ps_port;
	}
	public int getPs_id() {
		return ps_id;
	}
	public void setPs_id(int ps_id) {
		this.ps_id = ps_id;
	}
	public String getPs_name() {
		return ps_name;
	}
	public void setPs_name(String ps_name) {
		this.ps_name = ps_name;
	}
	public String getPs_ip() {
		return ps_ip;
	}
	public void setPs_ip(String ps_ip) {
		this.ps_ip = ps_ip;
	}
	public int getPs_port() {
		return ps_port;
	}
	public void setPs_port(int ps_port) {
		this.ps_port = ps_port;
	}
	
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public boolean isEdit() {
		return isEdit;
	}
	public void setEdit(boolean isEdit) {
		this.isEdit = isEdit;
	}
	
	public String toMGData(String Action) {
		String Result = Action + "|" + DatabaseSchema.PrinterSetting.SCHEMA_NAME
				+ "|(" + getPs_id() + "," + CheckNull(getPs_name()) + "," 
				+ CheckNull(getPs_ip()) +  "," + getPs_port() + ")";
		return Result;
	}
	
	public String CheckNull(String value){
		if(value == null){
			return null;
		}else{
			return "'" + value + "'";
		}
	}
}
